package com.mineoj.model.vo;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.mineoj.model.dto.question.JudgeConfig;
import com.mineoj.model.entity.Question;
import com.mineoj.model.entity.QuestionList;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 题目封装类

 */
@Data
public class QuestionListVO implements Serializable {
    /**
     * id
     */

    private Long id;

    /**
     * 标题
     */
    private String title;

    /**
     * 题单简介
     */
    private String content;

    /**
     * 收藏数
     */
    private Integer favourNum;

    /**
     * 题目数
     */
    private Integer questionNum;

    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 创建题目人的信息
     */
    private UserVO userVO;
    /**
     * 包装类转对象
     *
     * @param questionListVO
     * @return
     */
    public static QuestionList voToObj(QuestionListVO questionListVO) {
        if (questionListVO == null) {
            return null;
        }
        QuestionList question = new QuestionList();
        BeanUtils.copyProperties(questionListVO, question);

        return question;
    }

    /**
     * 对象转包装类
     *
     * @param questionList
     * @return
     */
    public static QuestionListVO objToVo(QuestionList questionList) {
        if (questionList == null) {
            return null;
        }
        QuestionListVO questionVO = new QuestionListVO();
        BeanUtils.copyProperties(questionList, questionVO);

        return questionVO;
    }

    private static final long serialVersionUID = 1L;
}